<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>RegularExpressionGroup</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">RegularExpressionGroup()</font></b></p>
<p><b>Syntax</b></p><blockquote>

Result$ = <font color="#006666"><b>RegularExpressionGroup</b></font>(#RegularExpression, Group)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>



Extract the string matched by a group within the regular expression 
after a call to <a href="nextregularexpressionmatch.html">NextRegularExpressionMatch()</a>. 

 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#RegularExpression</i></td>
<td width="90%"> 
 
The regular expression to use. <a href="examineregularexpression.html">ExamineRegularExpression()</a> and 
<a href="nextregularexpressionmatch.html">NextRegularExpressionMatch()</a> must have been called on this regular expression. 

 

</td></tr>
<tr><td><i>Group</i></td>
<td> 
 
The index of the group to extract. The first group has index 1. 

 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>



Returns the string matched by the regular expression group. 

 

</blockquote><p><b>Remarks</b></p><blockquote>



Groups in a regular expression are defined by surrounding a sub-expression 
with braces "(" and ")". The groups are numbered as they appear in the 
regular expression from left to right. The first group has index 1. 
The <a href="countregularexpressiongroups.html">CountRegularExpressionGroups()</a> function can be used to find out the number 
of groups in a regular expression. 
<br>
<br>
As an alternative, the <a href="regularexpressionnamedgroup.html">RegularExpressionNamedGroup()</a> function can be used. 

 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#006666">; This expression matches a color setting string (with value red, green or blue)</font>
  <font color="#006666">; The colors are grouped with () and the color value is extracted in case of a match</font>
  <font color="#006666">;  </font>
  <b><font color="#006666">If</font></b> <font color="#006666">CreateRegularExpression</font>(0, "color=(red|green|blue)")
    <b><font color="#006666">If</font></b> <font color="#006666">ExamineRegularExpression</font>(0, "stype=bold, color=blue, margin=50")
      <b><font color="#006666">While</font></b> <font color="#006666">NextRegularExpressionMatch</font>(0)
        <b><font color="#006666">Debug</font></b> "The color is " +<font color="#006666"> RegularExpressionGroup</font>(0, 1)
      <b><font color="#006666">Wend</font></b>
    <b><font color="#006666">EndIf</font></b>
  <b><font color="#006666">Else</font></b>
    <b><font color="#006666">Debug</font></b> <font color="#006666">RegularExpressionError</font>()
  <b><font color="#006666">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="examineregularexpression.html">ExamineRegularExpression()</a>, <a href="nextregularexpressionmatch.html">NextRegularExpressionMatch()</a>, 
<a href="regularexpressiongroupposition.html">RegularExpressionGroupPosition()</a>, <a href="regularexpressiongrouplength.html">RegularExpressionGroupLength()</a>, 
<a href="regularexpressionnamedgroup.html">RegularExpressionNamedGroup()</a> 

</Blockquote><p><b>Supported OS  </b><Blockquote>All</Blockquote></p><center>&lt;- <a href=regularexpressionerror.html>RegularExpressionError()</a> - <a href=index.html>RegularExpression Index</a> - <a href=regularexpressiongrouplength.html>RegularExpressionGroupLength()</a> -&gt;



</body></html>